<?php
	####################################################
	# library import and object instance.              #
	####################################################
	include_once('./common.php');


	####################################################
	# request data($_POST AND $_GET FROM $_REQUEST)    #
	####################################################
	# REQUEST(get and post variables)
	$req = Request::clean_request($_REQUEST, FALSE);

	# GET(url variables)

	# POST(form variables)

	# Validation(special case validate)
	//*/
	$req['mphone'] = StrFormat::convert_to_mobile_phone_number_remove_dash($req['mphone']);
	Validation::check_is_emptys($req);
	Validation::check_is_idpw($req['mid']);
	Validation::check_is_idpw($req['mpasswd']);
	Validation::check_is_email($req['memail']);
	Validation::check_is_phone($req['mphone']);
	Validation::check_is_equal($req['mpasswd'],$req['mpasswdc']);
	//Nlog::xmp($req); //display clean and remmap values
	//*/

	####################################################
	# implementation                                   #
	####################################################
	//*/
	# 회원 가입 정보를 삽입.
	$ret = $db->query(
		sprintf("INSERT INTO `n_member` VALUES ( NULL,'%s','%s','%s','%s','%s','%s','%s');",
			$req['mid'],
			$req['mpasswd'],
			$req['memail'],
			$req['mphone'],
			$req['mjob'],
			$req['msex'],
			$req['mmsg']
		)
	);
	//Nlog::xmp($ret);
	//*/
?>
<?php
	$html->custom_header(TITLE);
	$html->custom_js("{$JS}jquery.1.7.1.min.js");
	$html->custom_js("{$JS}lib.control.js");
	$html->custom_css("{$CSS}basic.css");
?>
<?$html->custom_body();?>
<?=$tmp->tiles_header()?>
	<h1>회원가입</h1>
	<?php if($ret): ?>
		회원가입 성공
	<?php else: ?>
		회원가입 실패 이미 가입된 멤버가 있습니다.
	<?php endif; ?>
	<br />
	<?=NTool::btn("뒤로", "Mover.back();");?>
	<?=NTool::btn("인덱스", "Mover.home();");?>
<?=$tmp->tiles_footer()?>
<?php $html->html_footer(); ?>